/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-

   credenza-window-pane.h: Credenza window pane

   Copyright (C) 2008 Free Software Foundation, Inc.

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License as
   published by the Free Software Foundation; either version 2 of the
   License, or (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.

   You should have received a copy of the GNU General Public
   License along with this program; if not, write to the
   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.

   Author: Holger Berndt <berndth@gmx.de>
*/

#ifndef CREDENZA_WINDOW_PANE_H
#define CREDENZA_WINDOW_PANE_H

#include "credenza-window.h"

#define CREDENZA_TYPE_WINDOW_PANE	 (credenza_window_pane_get_type())
#define CREDENZA_WINDOW_PANE_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), CREDENZA_TYPE_WINDOW_PANE, CredenzaWindowPaneClass))
#define CREDENZA_WINDOW_PANE(obj)	 (G_TYPE_CHECK_INSTANCE_CAST ((obj), CREDENZA_TYPE_WINDOW_PANE, CredenzaWindowPane))
#define CREDENZA_IS_WINDOW_PANE(obj)      (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CREDENZA_TYPE_WINDOW_PANE))
#define CREDENZA_IS_WINDOW_PANE_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), CREDENZA_TYPE_WINDOW_PANE))
#define CREDENZA_WINDOW_PANE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CREDENZA_TYPE_WINDOW_PANE, CredenzaWindowPaneClass))

typedef struct _CredenzaWindowPaneClass CredenzaWindowPaneClass;

struct _CredenzaWindowPaneClass {
	GObjectClass parent_class;

	void (*show) (CredenzaWindowPane *pane);
	void (*set_active) (CredenzaWindowPane *pane,
			    gboolean is_active);
	void (*sync_search_widgets) (CredenzaWindowPane *pane);
	void (*sync_location_widgets) (CredenzaWindowPane *pane);
};

/* A CredenzaWindowPane is a layer between a slot and a window.
 * Each slot is contained in one pane, and each pane can contain
 * one or more slots. It also supports the notion of an "active slot".
 * On the other hand, each pane is contained in a window, while each
 * window can contain one or multiple panes. Likewise, the window has
 * the notion of an "active pane".
 *
 * A spatial window has only one pane, which contains a single slot.
 * A navigation window may have one or more panes.
 */
struct _CredenzaWindowPane {
	GObject parent;

	/* hosting window */
	CredenzaWindow *window;
	gboolean visible;

	/* available slots, and active slot.
	 * Both of them may never be NULL. */
	GList *slots;
	GList *active_slots;
	CredenzaWindowSlot *active_slot;

	/* whether or not this pane is active */
	gboolean is_active;
};

GType credenza_window_pane_get_type (void);
CredenzaWindowPane *credenza_window_pane_new (CredenzaWindow *window);


void credenza_window_pane_show (CredenzaWindowPane *pane);
void credenza_window_pane_zoom_in (CredenzaWindowPane *pane);
void credenza_window_pane_zoom_to_level (CredenzaWindowPane *pane, CredenzaZoomLevel level);
void credenza_window_pane_zoom_out (CredenzaWindowPane *pane);
void credenza_window_pane_zoom_to_default (CredenzaWindowPane *pane);
void credenza_window_pane_sync_location_widgets (CredenzaWindowPane *pane);
void credenza_window_pane_sync_search_widgets  (CredenzaWindowPane *pane);
void credenza_window_pane_set_active (CredenzaWindowPane *pane, gboolean is_active);
void credenza_window_pane_slot_close (CredenzaWindowPane *pane, CredenzaWindowSlot *slot);

CredenzaWindowSlot* credenza_window_pane_get_slot_for_content_box (CredenzaWindowPane *pane, GtkWidget *content_box);
void credenza_window_pane_switch_to (CredenzaWindowPane *pane);
void credenza_window_pane_grab_focus (CredenzaWindowPane *pane);


#endif /* CREDENZA_WINDOW_PANE_H */
